package dao;

import java.sql.Connection;
import java.sql.DriverManager;

public class ConnectionFactory {
	private static String drivaerName="com.mysql.jdbc.Driver";
	private static String Protocol="jdbc:mysql://";
	private static String address="localhost";
	private static String post="3306";
	private static String dbName="cjgl1";
	private static String username="root";
	private static String password="root";
	public static Connection getConnection() {
		Connection conn=null;
		try {
			Class.forName(drivaerName);
			conn=DriverManager.getConnection(Protocol+address+":"+post+"/"+dbName,username,password);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return conn;
	}
	public static String getDrivaerName() {
		return drivaerName;
	}
	public static void setDrivaerName(String drivaerName) {
		ConnectionFactory.drivaerName = drivaerName;
	}
	public static String getProtocol() {
		return Protocol;
	}
	public static void setProtocol(String protocol) {
		Protocol = protocol;
	}
	public static String getAddress() {
		return address;
	}
	public static void setAddress(String address) {
		ConnectionFactory.address = address;
	}
	public static String getPost() {
		return post;
	}
	public static void setPost(String post) {
		ConnectionFactory.post = post;
	}
	public static String getDbName() {
		return dbName;
	}
	public static void setDbName(String dbName) {
		ConnectionFactory.dbName = dbName;
	}
	public static String getUsername() {
		return username;
	}
	public static void setUsername(String username) {
		ConnectionFactory.username = username;
	}
	public static String getPassword() {
		return password;
	}
	public static void setPassword(String password) {
		ConnectionFactory.password = password;
	}
	
	
}
